import request from '@/utils/request'

// 查询项目基本信息列表
export function listDealBase(query) {
  return request({
    url: '/deal/dealBase/listData',
    method: 'get',
    params: query
  })
}

export function listDataSelect(query) {
  return request({
    url: '/deal/dealBase/listDataSelect',
    method: 'get',
    params: query
  })
}

// 查询项目基本信息列表
export function dealIndicatorsDetails() {
  return request({
    url: '/deal/dealBase/dealIndicatorsDetails',
    method: 'get'
  })
}

// 查询投资数据看板-各省项目数量
export function getDealProvinceData() {
  return request({
    url: '/deal/dealBase/getDealProvinceData',
    method: 'get'
  })
}

// 分析报表查询投资数据看板-投资类型图表
export function getInvestTypeChartData() {
  return request({
    url: '/deal/dealBase/getInvestTypeChartData',
    method: 'get'
  })
}
// 分析报表查询投资数据看板-项目行业分布图表
export function getDealIndustryTypeChart() {
  return request({
    url: '/deal/dealBase/getDealIndustryTypeChart',
    method: 'get'
  })
}

// 分析报表查询投资数据看板-项目类型占比图表
export function getDealTypeDataChart() {
  return request({
    url: '/deal/dealBase/getDealTypeDataChart',
    method: 'get'
  })
}

// 根据省份ID查询项目相关数据 - 投资数据看板-点击省份数量中的具体省份时
export function getDealDateListByProvinceId(query) {
  return request({
    url: '/deal/dealBase/getDealDateListByProvinceId',
    method: 'get',
    params: query
  })
}
// 根据投资类型查询项目相关数据 - 投资数据看板-点击投资类型扇形图时
export function getDealInvestTypeList(query) {
  return request({
    url: '/deal/dealBase/getDealInvestTypeList',
    method: 'get',
    params: query
  })
}
// 根据投资类型查询项目相关数据 - 投资数据看板-点击项目行业分布扇形图时
export function getDealIndustryList(query) {
  return request({
    url: '/deal/dealBase/getDealIndustryList',
    method: 'get',
    params: query
  })
}
// 根据投资类型查询项目相关数据 - 投资数据看板-点击项目类型占比扇形图时
export function getDealTypeList(query) {
  return request({
    url: '/deal/dealBase/getDealTypeList',
    method: 'get',
    params: query
  })
}

export function findDealBroughtOutCompany(query) {
  return request({
    url: '/deal/dealBase/findDealBroughtOutCompany',
    method: 'get',
    params: query
  })
}

// 查询存在财务数据的项目公司信息
export function dealPcwList(query) {
  return request({
    url: '/deal/dealBase/dealPcwList',
    method: 'get',
    params: query
  })
}

// 查询项目基本信息详细
export function getDealBase(id) {
  return request({
    url: '/deal/dealBase/' + id,
    method: 'get'
  })
}

// 根据项目ID查询项目类型
export function getDealType(id) {
  return request({
    url: '/deal/dealBase/getDealType/' + id,
    method: 'get'
  })
}

// 查询项目基本信息详细
export function getKeyInformation(id) {
  return request({
    url: '/deal/dealBase/getKeyInformation/' + id,
    method: 'get'
  })
}

// 根据项目投资类型（股权/债权/参股基金）分组查询投资金额
export function findDealTypeGroup() {
  return request({
    url: '/deal/dealBase/findDealTypeGroup',
    method: 'get'
  })
}

// 查询项目基本信息详细
export function findDealKeyInfo(query) {
  return request({
    url: '/deal/dealBase/findDealKeyInfo',
    method: 'get',
    params: query
  })
}

// 保存项目基本信息
export function saveDealBase(data) {
  return request({
    url: '/deal/dealBase/save',
    method: 'post',
    data: data
  })
}

// 保存项目基本信息
export function reSaveDealBase(data) {
  return request({
    url: '/deal/dealBase/resave',
    method: 'post',
    data: data
  })
}

// 删除项目基本信息
export function delDealBase(id) {
  return request({
    url: '/deal/dealBase/' + id,
    method: 'delete'
  })
}

// 导出项目基本信息
export function exportDealBase(query) {
  return request({
    url: '/deal/dealBase/export',
    method: 'get',
    params: query
  })
}

// 项目logo上传
export function uploadAvatar(data) {
  return request({
    url: '/deal/dealBase/avatar',
    method: 'post',
    data: data
  })
}

// 查询项目是否已关注
export function getSysFocusOnBySourceId(id) {
  return request({
    url: '/focus/sysFocusOn/getSysFocusOnBySourceId?sourceId=' + id,
    method: 'get'
  })
}

// 保存项目基本信息
export function sysFocusOnSave(data) {
  return request({
    url: '/focus/sysFocusOn/save',
    method: 'post',
    data: data
  })
}

// 根据项目ID查询项目名称
export function getDealName(id) {
  return request({
    url: '/deal/dealBase/getName/' + id,
    method: 'get'
  })
  .then(result => result.code === 200 && result.data)
}

// 取消关注
export function delsysFocusOn(sourceId) {
  return request({
    url: '/focus/sysFocusOn/delete?sourceId=' + sourceId,
    method: 'get'
  })
}

// 查询项目(仅ID和名称)
export function findDeal(query) {
  return request({
    url: '/deal/dealBase/findDeal',
    method: 'get',
    params: query
  })
}

export function findDealPost(data) {
  return request({
    url: '/deal/dealBase/findDealPost',
    method: 'post',
    data: data
  })
}

export function findDealLimit(data) {
  return request({
    url: '/deal/dealBase/findDealLimit',
    method: 'post',
    data: data
  })
}

// 所有项目下拉
export function findDealBaseSelect() {
  return request({
    url: '/deal/dealBase/findDealBaseSelect',
    method: 'get'
  })
}

// 根据天眼查ID或者公司名称获取公司工商详情
export function getCompanyByName(query) {
  return request({
    url: '/company/companyBase/getCompanyByName',
    method: 'get',
    params: query
  })
}

// 根据项目名称，查询项目信息
export function getDealBaseByName(query) {
  return request({
    url: '/deal/dealBase/getDealBaseByName',
    method: 'get',
    params: query
  })
}

// 分析报表 - 项目团队成员统计
export function dealTeamCount(params) {
  return request({
    url: '/deal/dealBase/dealTeamCount',
    method: 'get',
    params: params
  })
}

// 分析报表 - 投资收益情况(个人)
export function investIncomePerson(data) {
  return request({
    url: '/deal/dealBase/investIncomePerson',
    method: 'post',
    data: data
  })
}
// 分析报表 - 投资收益情况(个人)-项目投资明细
export function dealInvestDetail(data) {
  return request({
    url: '/deal/dealBase/dealInvestDetail',
    method: 'post',
    data: data
  })
}

// 聚焦行业统计 获取聚焦行业下的投后项目数量
export function countIndustryFocus(type) {
  if (type === undefined || type === '') {
    type = 'XMJJHY'
  }
 return request({
   url: '/deal/dealBase/countIndustryFocus?type=' + type,
   method: 'get'
 })
}

// 根据聚焦行业查询
export function findByIndustryFocus(params) {
 return request({
   url: '/deal/dealBase/findByIndustryFocus',
   method: 'get',
   params: params
 })
}

// 统计项目区域分布 每个区域的投资金额
export function countDealArea(data) {
 return request({
   url: '/deal/dealBase/countDealArea',
   method: 'post',
   data: data
 })
}

// 统计项目区域分布 每个国家区域的投资金额
export function countDealCountryArea(data) {
 return request({
   url: '/deal/dealBase/countDealCountryArea',
   method: 'post',
   data: data
 })
}

// 大屏汇总数据
export function dataScreenSummary() {
  return request({
    url: '/report/dataScreen/summary',
    method: 'get'
  })
}

// 根据项目 基金等ID查出对应的文件
export function getLpView(id) {
  return request({
    url: '/deal/dealBase/getLpView/' + id,
    method: 'get'
  })
}

// 查询全部项目标的公司注册地-省是areaId的
export function findByProvinceRegistered(params) {
 return request({
   url: '/deal/dealBase/findByProvinceRegistered',
   method: 'get',
   params: params
 })
}

// 查询全部项目标的公司注册地-国家是areaId的
export function findByCountry(params) {
 return request({
   url: '/deal/dealBase/findByCountry',
   method: 'get',
   params: params
 })
}

// 查询项目阶段统计
export function countDealStage(data) {
 return request({
   url: '/deal/dealBase/countDealStage',
   method: 'post',
   data: data
 })
}

// 查询项目阶段统计
export function countDealStageBoard(data) {
 return request({
   url: '/deal/dealBase/countDealStageBoard',
   method: 'post',
   data: data
 })
}

// 根据项目阶段ID获取项目信息
export function findByNodeId(params) {
 return request({
   url: '/deal/dealBase/findByNodeId',
   method: 'get',
   params: params
 })
}

// 统计全部项目投资情况
export function countInvestment() {
 return request({
   url: '/deal/dealBase/countInvestment',
   method: 'get'
 })
}

// 获取菜单标识
export function getMenuId(id) {
  return request({
    url: '/deal/dealBase/getMenuId/' + id,
    method: 'get'
  })
}

// 数据大屏-项目类型占比
export function findDealTypeProportion() {
  return request({
    url: '/deal/dealBase/findDealTypeProportion',
    method: 'get'
  })
}

// 数据大屏-项目状态占比
export function findDealStatusProportion() {
  return request({
    url: '/deal/dealBase/findDealStatusProportion',
    method: 'get'
  })
}

// 终止项目
export function dealTermination(dealId, reason, type) {
  var dealTermination = {}
  dealTermination.dealId = dealId
  dealTermination.terminationReason = reason
  dealTermination.terminationType = type
  return request({
    url: '/deal/dealBase/dealTermination',
    method: 'post',
    data: dealTermination
  })
}

// 获取项目状态
export function getDealStatus(dealId) {
  return request({
    url: '/deal/dealBase/getDealStatus/' + dealId,
    method: 'get'
  })
}

// 批量项目导入
export function batchDealImport(data) {
  return request({
    url: '/deal/dealBase/batchDealImport/' + data.dealType,
    method: 'post',
    data: data.excelData
  })
}

// 根据项目ID获取项目负责人所属部门的领导所属部门信息
export function findDeptByDealId(dealId) {
  return request({
    url: '/deal/dealBase/findDeptByDealId/' + dealId,
    method: 'get'
  })
}

// 嘉善项目使用-大屏数据-项目类型占比
export function jsFindDealTypeProportion() {
  return request({
    url: '/report/compartment/findDealTypeProportion',
    method: 'get'
  })
}

// 嘉善项目使用-大屏数据-项目状态占比
export function jsFindDealStatusProportion() {
  return request({
    url: '/report/compartment/findDealStatusProportion',
    method: 'get'
  })
}

// 嘉善项目使用-大屏数据-统计项目区域分布
export function jsCountDealArea() {
  return request({
    url: '/report/compartment/countDealArea',
    method: 'get'
  })
}

// 嘉善项目使用-大屏数据-浮盈浮亏明细表
export function jsFindProfitLoss() {
  return request({
    url: '/report/compartment/findProfitLoss?year=2021',
    method: 'get'
  })
}

// 嘉善项目使用-大屏数据-投资轮次占比
export function jsFindDealGroupRound() {
  return request({
    url: '/report/compartment/findDealGroupRound',
    method: 'get'
  })
}

// 嘉善项目使用-大屏数据-聚焦行业占比
export function findDealGroupIndustryFocus() {
  return request({
    url: '/report/compartment/findDealGroupIndustryFocus',
    method: 'get'
  })
}

// 参股基金维度
export function bfData() {
  return request({
    url: '/report/compartment/bfData',
    method: 'get'
  })
}

// 直投项目维度
export function dealData() {
  return request({
    url: '/report/compartment/dealData',
    method: 'get'
  })
}

// 管理基金维度
export function fundData() {
  return request({
    url: '/report/compartment/fundData',
    method: 'get'
  })
}

// 参股基金、直投项目维度
export function summary() {
  return request({
    url: '/report/compartment/summary',
    method: 'get'
  })
}

// 创新及定向基金维度
export function findFundByCustomerId() {
  return request({
    url: '/report/compartment/findFundByCustomerId',
    method: 'get'
  })
}

// 查询股权投资情况简表
export function getEquityBriefTableReport(params) {
  return request({
    url: '/deal/dealBase/getEquityBriefTableReport',
    method: 'get',
    params: params
  })
}

// 查询租赁项目统计台账明细
export function findByStatisticalParameter(query) {
  return request({
    url: '/deal/dealBase/findByStatisticalParameter',
    method: 'get',
    params: query
  })
}

// 查询租赁项目已投放项目数据分析
export function findByTheRemainingPeriod(query) {
  return request({
    url: '/deal/dealBase/findByTheRemainingPeriod',
    method: 'get',
    params: query
  })
}

// 查询租赁项目区域统计
export function findByLeasingProvinces(query) {
  return request({
    url: '/deal/dealBase/findByLeasingProvinces',
    method: 'get',
    params: query
  })
}

// 查询租赁项目区域统计 根据区域汇总项目数
export function countLeaseDealArea(query) {
  return request({
    url: '/deal/dealBase/countLeaseDealArea',
    method: 'get',
    params: query
  })
}

// 查询租赁项目行业统计大类
export function findByLeasingIndustryFirst(query) {
  return request({
    url: '/deal/dealBase/findByLeasingIndustryFirst',
    method: 'get',
    params: query
  })
}

// 租赁项目行业大类统计 根据行业大类汇总项目数
export function countLeaseDealIndustryFirst(query) {
  return request({
    url: '/deal/dealBase/countLeaseDealIndustryFirst',
    method: 'get',
    params: query
  })
}

// 租赁项目行业二级统计 根据行业二级汇总项目数
export function countLeaseDealIndustrySecond(query) {
  return request({
    url: '/deal/dealBase/countLeaseDealIndustrySecond',
    method: 'get',
    params: query
  })
}

// 租赁项目企业性质统计
export function findByLeasingEnterpriseNature(query) {
  return request({
    url: '/deal/dealBase/findByLeasingEnterpriseNature',
    method: 'get',
    params: query
  })
}

// 租赁项目企业性质统计 根据企业性质汇总项目数
export function countLeaseDealEnterpriseNature(query) {
  return request({
    url: '/deal/dealBase/countLeaseDealEnterpriseNature',
    method: 'get',
    params: query
  })
}

// 租赁项目交易模式统计 根据交易模式汇总项目数
export function countLeaseDealTransactionMode(query) {
  return request({
    url: '/deal/dealBase/countLeaseDealTransactionMode',
    method: 'get',
    params: query
  })
}

// 租赁项目客户来源统计 根据客户来源汇总项目数
export function countLeaseDealCustomerSource(query) {
  return request({
    url: '/deal/dealBase/countLeaseDealCustomerSource',
    method: 'get',
    params: query
  })
}

// 分析报表 - 团队人员项目统计-列表数据
export function findDealByTeam(query) {
  return request({
    url: '/deal/dealBase/findDealByTeam',
    method: 'get',
    params: query
  })
}

// 分析报表 - 团队人员项目统计-柱桩图数据
export function countDealByPersonCharge(query) {
  return request({
    url: '/deal/dealBase/countDealByPersonCharge',
    method: 'get',
    params: query
  })
}

// 查询项目现金流指标
export function getDealCashFLowInfo(query) {
  return request({
    url: '/deal/dealBase/getDealCashFLowInfo',
    method: 'get',
    params: query
  })
}

// 查询项目现金流指标
export function getDealCashFLowBfInfo(query) {
  return request({
    url: '/deal/dealBase/getDealCashFLowBfInfo',
    method: 'get',
    params: query
  })
}
// 根据busId和type获取
export function getXirrDataByType(query) {
  return request({
    url: '/deal/dealBase/getXirrDataByType',
    method: 'get',
    params: query
  })
}

// 查询项目现金流指标
export function getDicts() {
  return request({
    url: '/deal/dealBase/getDicts',
    method: 'get'
  })
}
// 查询项目现金流指标
export function getBfDicts() {
  return request({
    url: '/deal/dealBase/getBfDicts',
    method: 'get'
  })
}

// 查询项目现金流指标
export function getDealBaseHomeInfo(dealId, companyId) {
  return request({
    url: '/deal/dealBase/getDealBaseHomeInfo',
    method: 'get',
    params: {
      dealId,
      companyId
    }
  })
}

export function getDealInfo(dealId, investId) {
  return request({
    url: '/deal/dealBase/getDealInfo',
    method: 'get',
    params: {
      dealId,
      investId
    }
  })
}
export function getDealInfoData(dealId, investId) {
  return request({
    url: '/deal/dealBase/getDealInfoData',
    method: 'get',
    params: {
      dealId,
      investId
    }
  })
}

// 查询风控管理项目概览
export function dealOverviewList(query) {
  return request({
    url: '/deal/dealBase/dealOverviewList',
    method: 'get',
    params: query
  })
}

// 产业地图查询项目
export function getDealListLite(query) {
  return request({
    url: '/deal/dealBase/getDealList',
    method: 'get',
    params: query
  })
}

// 项目列表根据项目名称查询
export function listDealBaseByInvestName(dealName) {
  return request({
    url: '/deal/dealBase/listDealBaseByInvestName?dealName=' + dealName,
    method: 'get'
  })
}
